{% extends 'base.html' %}
{% block content %}

<link rel="stylesheet" href="/css/home.css">
<div class="a">
        <div class="search">
            <input type="text"  class="search-input" placeholder="请输入关键字" id="searchInput">
           <button onclick="searchData()">搜索</button>
        </div>

        <div class="search-right">
            <div class="search-right1">最新文章</div>
            <ol>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
            </ol>
        </div>

        <div class="search-right">
            <div class="search-right1">特别推荐</div>
            <ol>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
                <li>web系统开发框架特性对比分</li>
            </ol>
        </div>

    </div>
<div class="home-content"></div>
    <div class="logo">
        <img src="/image/1.jpg" width="1100px" height="300px"></img>
    </div>
    <div class="article-list">
        <div class="article-item">
            <div class="article-item-img">
                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>
            </div>
            <div class="article-content">
                <h2>利用python flask框架开发web应用系统</h2>

                <p>
                    <span>作者：邓强</span> &nbsp;&nbsp;&nbsp;
                    <span>类别：python开发</span> &nbsp;&nbsp;&nbsp;
                    <span>日期：2020-02-12 &nbsp 15:25:38</span>&nbsp;&nbsp;&nbsp;
                    <span>阅读：100次</span>&nbsp;&nbsp;&nbsp;
                    <span>消耗积分：  5分</span>&nbsp;&nbsp;&nbsp;
                </p>
                <div id="content">
                    <script>
                        let longText = "这是一段很长很长的文字内容......";
                        let limitedText = longText.slice(0,25);
                        document.getElementById("content").innerHTML = limitedText;
                    </script>
                </div>
            </div>
        </div>
        <div class="article-item">
            <div class="article-item-img">
                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>
            </div>
            <div class="article-content">
                <h2>利用python flask框架开发web应用系统</h2>

                <p>
                    <span>作者：邓强</span> &nbsp;&nbsp;&nbsp;
                    <span>类别：python开发</span> &nbsp;&nbsp;&nbsp;
                    <span>日期：2020-02-12 &nbsp 15:25:38</span>&nbsp;&nbsp;&nbsp;
                    <span>阅读：100次</span>&nbsp;&nbsp;&nbsp;
                    <span>消耗积分：  5分</span>&nbsp;&nbsp;&nbsp;
                </p>
                <div>
                    Flask作为目前最流行的pythonweb应用系统后台开发框架之一，在web系统开发上
                    有着非常全面的功能。由于具有轻量级的特点，非常适合初学者入门，学习周期相对较短
                </div>
            </div>
        </div>
        <div class="article-item">
            <div class="article-item-img">
                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>
            </div>
            <div class="article-content">
                <h2>利用python flask框架开发web应用系统</h2>

                <p>
                    <span>作者：邓强</span> &nbsp;&nbsp;&nbsp;
                    <span>类别：python开发</span> &nbsp;&nbsp;&nbsp;
                    <span>日期：2020-02-12 &nbsp 15:25:38</span>&nbsp;&nbsp;&nbsp;
                    <span>阅读：100次</span>&nbsp;&nbsp;&nbsp;
                    <span>消耗积分：  5分</span>&nbsp;&nbsp;&nbsp;
                </p>
                <div>
                    Flask作为目前最流行的pythonweb应用系统后台开发框架之一，在web系统开发上
                    有着非常全面的功能。由于具有轻量级的特点，非常适合初学者入门，学习周期相对较短
                </div>
            </div>
        </div>
        <div class="article-item">
            <div class="article-item-img">
                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>
            </div>
            <div class="article-content">
                <h2>利用python flask框架开发web应用系统</h2>

                <p>
                    <span>作者：邓强</span> &nbsp;&nbsp;&nbsp;
                    <span>类别：python开发</span> &nbsp;&nbsp;&nbsp;
                    <span>日期：2020-02-12 &nbsp 15:25:38</span>&nbsp;&nbsp;&nbsp;
                    <span>阅读：100次</span>&nbsp;&nbsp;&nbsp;
                    <span>消耗积分：  5分</span>&nbsp;&nbsp;&nbsp;
                </p>
                <div>
                    Flask作为目前最流行的pythonweb应用系统后台开发框架之一，在web系统开发上
                    有着非常全面的功能。由于具有轻量级的特点，非常适合初学者入门，学习周期相对较短
                </div>
            </div>
        </div>
        <div class="article-item">
            <div class="article-item-img">
                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>
            </div>
            <div class="article-content">
                <h2>利用python flask框架开发web应用系统</h2>

                <p>
                    <span>作者：邓强</span> &nbsp;&nbsp;&nbsp;
                    <span>类别：python开发</span> &nbsp;&nbsp;&nbsp;
                    <span>日期：2020-02-12 &nbsp 15:25:38</span>&nbsp;&nbsp;&nbsp;
                    <span>阅读：100次</span>&nbsp;&nbsp;&nbsp;
                    <span>消耗积分：  5分</span>&nbsp;&nbsp;&nbsp;
                </p>
                <div>
                    Flask作为目前最流行的pythonweb应用系统后台开发框架之一，在web系统开发上
                    有着非常全面的功能。由于具有轻量级的特点，非常适合初学者入门，学习周期相对较短
                </div>
            </div>
        </div>
</div>
<div class="page-num">
      <nav aria-label="..."  class="page-num-nav">
          <ul class="pagination pagination-lg">
             <li class="page-item" aria-current="page">
                 <a href="#" class="page-link no-now">上一页</a>
             </li>
              <li class="page-item active" aria-current="page">
                <span class="page-link">1</span>
              </li>
              <li class="page-item" aria-current="page"><a href="#" class="page-link no-now">2</a></li>
              <li class="page-item" aria-current="page"><a href="#" class="page-link no-now">3</a></li>
              <li class="page-item" aria-current="page">
                  <a href="#" class="page-link no-now">下一页</a>
              </li>
          </ul>
      </nav>

</div>




<!--引入JQuery架包 -->
<script src="/js/jquery-3.4.1.min.js"></script>
<script>
     window.addEventListener('scroll', function() {
    var sidebar = document.querySelector('.a');
    var scrollPosition = window.pageYOffset || document.documentElement.scrollTop;

    // 当页面滚动到顶部时，恢复侧边导航栏的初始位置
    if (scrollPosition === 0) {
        sidebar.style.position = 'absolute';
        sidebar.style.top = '172px'; // 恢复到距离网页上方150px的初始位置
        sidebar.style.right = '0';
    } else if (scrollPosition > 170) {
        // 当页面向下滚动超过170px时，将侧边导航栏固定在顶部
        sidebar.style.position = 'fixed';
        sidebar.style.top = '0';
        sidebar.style.right = '0';
    } else {
        // 当页面滚动未超过170px时，保持侧边导航栏在初始位置
        sidebar.style.position = 'absolute';
        sidebar.style.top = '172px'; // 保持距离网页上方150px
        sidebar.style.right = '0';
    }
});

    $(document).ready(function(){  // 文档就绪函数
        //这个函数在文档加载完毕后自动执行
        $.ajax({
            url:"article/list/1",
            type:"POST",
            dataType: "json",
            data:{},
            success: function(data){
               if(data.code == 1) {
                   let articles = data.info;
                   let html_str = "";//表示生成页面的代码
                   // 遍历文章列表
                   for (let i = 0; i < articles.length; i++) {
                   //for(let i = 0; i <1; i++){
                       content = ""
                       //创建了一个p标签
                       let P = document.createElement("p");
                       //获取p标签的文本，替换文字中的换行符
                       P.innerHTML = articles[i].content;
                       content = P.innerText.replaceAll('\n', '');
                       html_str += '<div class="article-item">\n' +
                           '<a href="article/'+articles[i].articleid+'" style="color: black">'+
                           '            <div class="article-item-img">\n' +
                           '                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>\n' +
                           '            </div>\n' +
                           '            <div class="article-content">\n' +
                           '                <h2 style="font-size: 22px">' + articles[i].headline + '</h2>\n' +
                           '\n' +
                           '                <p>\n' +
                           '                    <span>作者：'+articles[i].nickname+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>类别：'+articles[i].type+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>日期：'+articles[i].updatetime+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>阅读：'+articles[i].readcount+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>消耗积分： '+articles[i].credit+'分</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                </p>\n' +
                           '                <div class="text-container">\n' + content +
                           '                </div>\n' +
                           '            </div>' +
                           '            </a>' +
                           '        </div>';
                       console.log(html_str);
                       console.log(i);
                   }

                   $('.article-list').empty();//清空文章列表
                   $('.article-list').append(html_str);//添加刚刚生成的数据

                   let page_str = '<ul class="pagination pagination-lg">';
                   let max_page = data.page.max_page;
                   let now_page = data.page.now_page;
                   if (now_page == 1) {
                       page_str += '<li class="page-item"> <span class="page-link">上一页</span></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">1</span></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">2</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(3)" class="page-link no-now">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">下一页</a></li>';
                   }else if(now_page == 2){
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">上一页</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">1</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">2</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(4)" class="page-link no-now">4</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">下一页</a></li>';
                   }else if(now_page == max_page){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item > <span class="page-link"></span>下一页</li>';
                   }else if(now_page == max_page-1){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }else{
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+2)+')">'+(now_page+2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }

                   page_str += '</ul>';
                   $('.page-num-nav').empty();
                   $('.page-num-nav').append(page_str);
               }else{
                   alert("当前没有数据")
               }
            },
            error:     function(e){
                alert("网络请求失败，请检查网络")

            }
        });
    })

    function getData(page_num){
        let param = "keyword="+$('#searchInput').val()
        $.post('article/search/'+page_num, param, function (data){
               if(data.code == 1) {
                   let articles = data.info;
                   let html_str = "";//表示生成页面的代码
                   // 遍历文章列表
                   for (let i = 0; i < articles.length; i++) {
                   //for(let i = 0; i <1; i++){
                       content = ""
                       //创建了一个p标签
                       let P = document.createElement("p");
                       //获取p标签的文本，替换文字中的换行符
                       P.innerHTML = articles[i].content;
                       content = P.innerText.replaceAll('\n', '');
                       html_str += '<div class="article-item">\n' +
                           '<a href="article/'+articles[i].articleid+'" style="color: black">'+
                           '            <div class="article-item-img">\n' +
                           '                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>\n' +
                           '            </div>\n' +
                           '            <div class="article-content">\n' +
                           '                <h2 style="font-size: 22px">' + articles[i].headline + '</h2>\n' +
                           '\n' +
                           '                <p>\n' +
                           '                    <span>作者：'+articles[i].nickname+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>类别：'+articles[i].type+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>日期：'+articles[i].updatetime+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>阅读：'+articles[i].readcount+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>消耗积分： '+articles[i].credit+'分</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                </p>\n' +
                           '                <div class="text-container">\n' + content +
                           '                </div>\n' +
                           '            </div>' +
                           '            </a>' +
                           '        </div>';
                       console.log(html_str);
                       console.log(i);
                   }

                   $('.article-list').empty();//清空文章列表
                   $('.article-list').append(html_str);//添加刚刚生成的数据

                   let page_str = '<ul class="pagination pagination-lg">';
                   let max_page = data.page.max_page;
                   let now_page = data.page.now_page;
                   if (now_page == 1) {
                       page_str += '<li class="page-item"> <span class="page-link">上一页</span></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">1</span></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">2</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(3)" class="page-link no-now">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">下一页</a></li>';
                   }else if(now_page == 2){
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">上一页</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">1</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">2</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(4)" class="page-link no-now">4</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">下一页</a></li>';
                   }else if(now_page == max_page){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item > <span class="page-link"></span>下一页</li>';
                   }else if(now_page == max_page-1){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }else{
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+2)+')">'+(now_page+2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }

                   page_str += '</ul>';
                   $('.page-num-nav').empty();
                   $('.page-num-nav').append(page_str);
               }else{
                   alert("当前没有数据")
               }
        });
    }

    function searchData(){

        let param = "keyword="+$('#searchInput').val()
        $.post('article/search/1', param, function (data){
               if(data.code == 1) {
                   let articles = data.info;
                   let html_str = "";//表示生成页面的代码
                   // 遍历文章列表
                   for (let i = 0; i < articles.length; i++) {
                   //for(let i = 0; i <1; i++){
                       content = ""
                       //创建了一个p标签
                       let P = document.createElement("p");
                       //获取p标签的文本，替换文字中的换行符
                       P.innerHTML = articles[i].content;
                       content = P.innerText.replaceAll('\n', '');
                       html_str += '<div class="article-item">\n' +
                           '<a href="article/'+articles[i].articleid+'" style="color: black">'+
                           '            <div class="article-item-img">\n' +
                           '                <img src="/image/3.jpg" alt="" width="300px" height="200px"></img>\n' +
                           '            </div>\n' +
                           '            <div class="article-content">\n' +
                           '                <h2 style="font-size: 22px">' + articles[i].headline + '</h2>\n' +
                           '\n' +
                           '                <p>\n' +
                           '                    <span>作者：'+articles[i].nickname+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>类别：'+articles[i].type+'</span> &nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>日期：'+articles[i].updatetime+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>阅读：'+articles[i].readcount+'</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                    <span>消耗积分： '+articles[i].credit+'分</span>&nbsp;&nbsp;&nbsp;\n' +
                           '                </p>\n' +
                           '                <div class="text-container">\n' + content +
                           '                </div>\n' +
                           '            </div>' +
                           '            </a>' +
                           '        </div>';
                       console.log(html_str);
                       console.log(i);
                   }

                   $('.article-list').empty();//清空文章列表
                   $('.article-list').append(html_str);//添加刚刚生成的数据

                   let page_str = '<ul class="pagination pagination-lg">';
                   let max_page = data.page.max_page;
                   let now_page = data.page.now_page;
                   if (now_page == 1) {
                       page_str += '<li class="page-item"> <span class="page-link">上一页</span></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">1</span></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">2</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(3)" class="page-link no-now">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(2)" class="page-link no-now">下一页</a></li>';
                   }else if(now_page == 2){
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">上一页</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(1)" class="page-link no-now">1</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">2</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">3</a></li>';
                       page_str += '<li class="page-item"><a href="javascript:getData(4)" class="page-link no-now">4</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData(3)">下一页</a></li>';
                   }else if(now_page == max_page){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item > <span class="page-link"></span>下一页</li>';
                   }else if(now_page == max_page-1){
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }else{
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">上一页</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-2)+')">'+(now_page-2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page-1)+')">'+(now_page-1)+'</a></li>';
                       page_str += '<li class="page-item active" aria-current="page"> <span class="page-link">'+now_page+'</span></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">'+(now_page+1)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+2)+')">'+(now_page+2)+'</a></li>';
                       page_str += '<li class="page-item"><a class="page-link no-now" href="javascript:getData('+(now_page+1)+')">下一页</a></li>';
                   }

                   page_str += '</ul>';
                   $('.page-num-nav').empty();
                   $('.page-num-nav').append(page_str);
               }else{
                   alert("当前没有数据")
               }
            })
    }
</script>





{% endblock %}